package ygflower.validator;

import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

import ygflower.domain.Flower;

public class FlowerValidator implements Validator{
	@Override
	public boolean supports(Class clazz){
		return clazz==Flower.class;
	}


	@Override
	public void validate(Object arg0, Errors errors) {
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, Flower.PropertyName, "必须填写名称");
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, Flower.PropertyMarketPrice, "必须写市场价格");
		
	}

}
